import requests

from conf.readconf import ReadConf

#  实例化类的对象，后面需要用到v部落的url地址，直接调用函数返回
rf = ReadConf()


def get_vlog_cookie():
    datas = {"username": "sang", "password": 123}
    vlog_url = rf.get_vlog("v_url")
    rs = requests.post(vlog_url + "/login", data=datas)
    #  获取cookie
    vlog_cookie = requests.utils.dict_from_cookiejar(rs.cookies)
    return vlog_cookie["JSESSIONID"]
